Primary client script execution feedback#484
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #484 +/- ##
==========================================
- Coverage 76.96% 76.66% -0.31%
==========================================
Files 116 116
Lines 6343 6561 +218
Branches 2761 2897 +136
==========================================
+ Hits 4882 5030 +148
- Misses 1113 1163 +50
- Partials 348 368 +20 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
urfeex
left a comment
There was a problem hiding this comment.
First, very high-level overview.
urfeex
left a comment
There was a problem hiding this comment.
There seems to be an error somewhere in the logic. When I run the example with a robot that is not break-released, it releases breaks correctly, but then not all following commands are executed. I don't know whether there are some messages being lost due to the frequency things are called with or if there are flags that would need to be reset on the way.
This could be related with the error code handling. One example output is
[1776862206.490350] INFO /home/feex/git/ur_client_library/src/primary/primary_client.cpp 74: Starting primary client pipeline
Client connected
[1776862212.575126] INFO /home/feex/git/ur_client_library/include/ur_client_library/primary/primary_consumer.h 147: Logging an ErrorCodeMessage from the UR Controller Box: C100A7
[1776862212.581287] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 237: Robot encountered error(s) during script execution, stopping program
[1776862212.581336] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581351] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581362] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581385] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581397] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581407] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581426] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581438] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581453] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581466] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581488] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581505] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C286A1
[1776862212.581516] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C304A4
[1776862212.581537] ERROR /home/feex/git/ur_client_library/src/primary/primary_client.cpp 240: Robot error code: C100A7
[1776862212.684815] INFO /home/feex/git/ur_client_library/src/primary/primary_client.cpp 262: Script with name cool_function_name started
[1776862212.684926] INFO /home/feex/git/ur_client_library/src/primary/primary_client.cpp 256: Script with name cool_function_name executed successfully
[1776862212.685579] INFO /home/feex/git/ur_client_library/src/primary/primary_client.cpp 68: Stopping primary client pipeline
34d20cb to
89f09ff
Compare
Adds function definition (if missing) and gives the function a name.
to use dashboard client, as the new implementation of sendScript is not compatible with the structure it has.
sendScript now fails when runtime exception is thrown
Co-authored-by: Felix Exner <feex@universal-robots.com>
Add non-blocking send, add error case
fd597e0 to
4e0fced
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.
Reviewed by Cursor Bugbot for commit fcd7448. Configure here.

This is not quite done yet, but the main logic and the test cases are there
Still missing documentation and example also needs to be finished.
Note
Medium Risk
Adds new blocking script-execution path in
PrimaryClientthat actively interprets robot state/messages and can stop programs on errors; correctness depends on message ordering/timing and introduces new failure/timeout behaviors.Overview
Adds
PrimaryClient::sendScriptBlocking()to execute URScript via the primary interface with execution feedback, including pre-flight checks (robot mode + safety mode), optional warning handling, and failure on runtime exceptions or robot error codes.Introduces script preparation/validation (comment/whitespace stripping, auto-wrapping snippets into
def, script-name validation/truncation) and wiresKeyMessage+RuntimeExceptionMessagecallbacks/queues to detect STARTED/STOPPED and exceptions (including a short post-stop drain period to avoid missing late warnings).Includes a new
ScriptCodeSyntaxException, updates runtime-exception line/column types to unsigned, adds extensivetest_primary_clientcoverage, and ships matching docs plus a newsend_scriptexample + build wiring (and a GCC 13–15 warning suppression forprimary_client.cpp).Reviewed by Cursor Bugbot for commit 6ff46e0. Bugbot is set up for automated code reviews on this repo. Configure here.